//
//  CollectionHeaderCollectionViewCell.m
//  HandWork
//
//  Created by 王阳阳 on 16/1/22.
//  Copyright © 2016年 www.lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "CollectionHeaderCollectionViewCell.h"

@implementation CollectionHeaderCollectionViewCell

-(void)dealloc
{
    [_bgimg release];
    [_title release];
    [_price release];
    [_num release];
    [_oldprice release];
    [super dealloc];
}
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        //图片
        self.bgimg = [[UIImageView alloc]init];
        [self.contentView addSubview:self.bgimg];
        [_bgimg release];
        //标题
        self.title = [[UILabel alloc]init];
        [self.contentView addSubview:self.title];
        [_title release];
        //价格
        self.price = [[UILabel alloc]init];
        [self.contentView addSubview:self.price];
        [_price release];
//        购买个数
        self.num = [[UILabel alloc]init];
        [self.contentView addSubview:self.num];
        [_num release];
        //以前的价格
        self.oldprice = [[UILabel alloc]init];
        [self.contentView addSubview:self.oldprice];
        [_oldprice release];
        
    }
    return self;
}
- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
    [super applyLayoutAttributes:layoutAttributes];
    //图片
    self.bgimg.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width / 2-10, 120);
//    self.bgimg.backgroundColor = [UIColor redColor];
    //标题
    self.title.frame = CGRectMake(0, self.bgimg.frame.size.height+5, [UIScreen mainScreen].bounds.size.width / 2-10, 40);
    self.title.textColor = [UIColor grayColor];
    self.title.numberOfLines = 0;
    self.title.font = [UIFont systemFontOfSize:14];
//    self.title.backgroundColor = [UIColor yellowColor];
    //价格
    self.price.frame = CGRectMake(0, self.title.frame.origin.y + self.title.frame.size.height+5, [UIScreen mainScreen].bounds.size.width /4, 40);
    self.price.font = [UIFont systemFontOfSize:17];
    self.price.textColor = [UIColor redColor];
//    self.price.backgroundColor = [UIColor greenColor];
    
    
    self.oldprice.frame =CGRectMake(self.price.frame.size.width, self.title.frame.origin.y + self.title.frame.size.height + 5, self.contentView.frame.size.width /2, 20);
    self.oldprice.font = [UIFont systemFontOfSize:10];
    self.oldprice.textColor = [UIColor grayColor];
//    self.oldprice.backgroundColor = [UIColor orangeColor];
    //购买个数
    self.num.frame = CGRectMake(self.price.frame.size.width + 5, self.title.frame.origin.y + self.title.frame.size.height + 20, self.contentView.frame.size.width /2, 20);
    self.num.textColor = [UIColor grayColor];
    self.num.font = [UIFont systemFontOfSize:10];
//    self.num.backgroundColor = [UIColor cyanColor];
}
@end
